<include file="Public/min-header"/>
<!--物流配置 css -start-->
<style>
    ul.group-list {
        width: 96%;min-width: 1000px; margin: auto 5px;list-style: disc outside none;
    }
    ul.group-list li {
        white-space: nowrap;float: left;
        width: 150px; height: 25px;
        padding: 3px 5px;list-style-type: none;
        list-style-position: outside;border: 0px;margin: 0px;
    }
</style>
<!--物流配置 css -end-->

<div class="wrapper">
    <include file="Public/breadcrumb"/>
    <section class="content">
        <!-- Main content -->
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i>商品详情</h3>
                </div>
                <div class="panel-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_tongyong" data-toggle="tab">通用信息</a></li>
                    </ul>
                    <!--表单数据-->
                    <form method="post" id="addEditGoodsForm">
                        <!--通用信息-->
                    <div class="tab-content">                 	  
                        <div class="tab-pane active" id="tab_tongyong">
                           
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <td>商品名称:</td>
                                    <td>
                                        <input type="text" value="{$goodsInfo.goods_name}" name="goods_name" class="form-control" style="width:550px;"/>
                                        <span id="err_goods_name" style="color:#F00; display:none;"></span>                                        
                                    </td>
                                </tr>
                                <tr>
                                    <td>等待天数:</td>
                                    <td>
                                        <input type="text" value="{$goodsInfo.wait_time}" name="wait_time" class="form-control" style="width:150px;" onkeyup="this.value=this.value.replace(^[1-9]\d*$,'')" onpaste="this.value=this.value.replace(^[1-9]\d*$,'')" />
                                        <span id="err_goodsInfo.wait_time" style="color:#F00; display:none;"></span>					                                        
                                    </td>
                                </tr>
								<tr>
								    <td>进行天数:</td>
								    <td>
								        <input type="text" value="{$goodsInfo.conduct_time}" name="conduct_time" class="form-control" style="width:150px;" onkeyup="this.value=this.value.replace(^[1-9]\d*$,'')" onpaste="this.value=this.value.replace(^[1-9]\d*$,'')" />
								        <span id="err_goodsInfo.conduct_time" style="color:#F00; display:none;"></span>					                                        
								    </td>
								</tr>
								<tr>
								    <td>需要参与人数:</td>
								    <td>
								        <input type="text" value="{$goodsInfo.need_number}" name="need_number" class="form-control" style="width:150px;" onkeyup="this.value=this.value.replace(^[1-9]\d*$,'')" onpaste="this.value=this.value.replace(^[1-9]\d*$,'')" />
								        <span id="err_goodsInfo.need_number" style="color:#F00; display:none;"></span>					                                        
								    </td>
								</tr>
								
                                <tr>
                                    <td>上传商品图片:</td>
                                    <td>
                                        <input type="button" value="上传图片"  onclick="GetUploadify(1,'','goods','call_back');"/>
                                        <input type="text" class="input-sm"  name="original_img" id="original_img" value="{$goodsInfo.original_img}"/>
                                        <if condition="$goodsInfo['original_img'] neq null">
                                            &nbsp;&nbsp;
                                            <a target="_blank" href="{$goodsInfo.original_img}" id="original_img2">
                                                <img width="25" height="25" src="{$goodsInfo.original_img}">
                                            </a>
                                        </if>
                                        <span id="err_original_img" style="color:#F00; display:none;"></span>					                                        
                                    </td>
                                </tr>                                 
                               
                                <tr>
                                    <td>是否上架:</td>
                                    <td>
                                        是:<input type="radio" <if condition="$goodsInfo[is_on_sale] eq 1">checked="checked"</if> value="1" name="is_on_sale" /> 
                                        否:<input type="radio" <if condition="$goodsInfo[is_on_sale] eq 0">checked="checked"</if> value="0" name="is_on_sale" /> 
                                    </td>
                                </tr>                                
                                
                                </tbody>                                
                                </table>
                        </div>
                         <!--其他信息-->
                        
                    </div>              
                    <div class="pull-right">
                        <input type="hidden" name="spell_goods_id" value="{$goodsInfo.spell_goods_id}">
                        <button class="btn btn-primary" onclick="ajax_submit_form('addEditGoodsForm','{:U('Spell/addEditGoods?is_ajax=1')}');" title="" data-toggle="tooltip" type="button" data-original-title="保存">保存</button>
                    </div>
			    </form><!--表单数据-->
                </div>
            </div>
        </div>    <!-- /.content -->
    </section>
</div>

<!-- 选择器js -->
<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/js/chosen.jquery.min.js"></script>
<link href="__ROOT__/Public/css/chosen.min.css" rel="stylesheet" type="text/css" ></link>
<script>
    $(document).ready(function(){

        $('#brand_id').chosen({
            search_contains: true
        });
    
        $(":checkbox[cka]").click(function(){
            var $cks = $(":checkbox[ck='"+$(this).attr("cka")+"']");
            if($(this).is(':checked')){
                $cks.each(function(){$(this).prop("checked",true);});
            }else{
                $cks.each(function(){$(this).removeAttr('checked');});
            }
        });
    });

    function choosebox(o){
        var vt = $(o).is(':checked');
        if(vt){
            $('input[type=checkbox]').prop('checked',vt);
        }else{
            $('input[type=checkbox]').removeAttr('checked');
        }
    }
    /*
     * 以下是图片上传方法
     */
    // 上传商品图片成功回调函数
    function call_back(fileurl_tmp){
        $("#original_img").val(fileurl_tmp);
    	$("#original_img2").attr('href', fileurl_tmp);
    }
 
    // 上传商品相册回调函数
    function call_back2(paths){
        
        var  last_div = $(".goods_xc:last").prop("outerHTML");	
        for (i=0;i<paths.length ;i++ )
        {                    
            $(".goods_xc:eq(0)").before(last_div);	// 插入一个 新图片
                $(".goods_xc:eq(0)").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
            $(".goods_xc:eq(0)").find('img').attr('src',paths[i]);// 修改他的图片路径
                $(".goods_xc:eq(0)").find('a:eq(1)').attr('onclick',"ClearPicArr2(this,'"+paths[i]+"')").text('删除');
            $(".goods_xc:eq(0)").find('input').val(paths[i]); // 设置隐藏域 要提交的值
        } 			   
    }
   
 


</script>
</body>
</html>